package com.jsmtr.rms.controller;

import java.util.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jsmtr.rms.entity.*;
import com.jsmtr.rms.service.IProjectService;
import com.jsmtr.rms.utils.StringTools;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.jsmtr.rms.service.IDoGXService;
import com.jsmtr.rms.service.IUtilService;
import com.jsmtr.rms.utils.DateTools;
import com.jsmtr.rms.utils.EnumTools;


@Controller
@RequestMapping("/Do/GXResume")
public class DoGXResumeController {

    @Resource
    private IUtilService utilService;

    @Resource
    private IDoGXService doGXService;

    @Resource
    private IProjectService projectService;

    //[start] 查询毕业生信息

    //首页
    @RequestMapping("/")
    public String Index(HttpServletRequest request, Model model) {
        try {
            model.addAttribute("path", request.getContextPath());
            String pid = request.getParameter("pid").trim();
            String fid = request.getParameter("fid").trim();
            String deptcode = request.getParameter("deptcode").trim();

            model.addAttribute("pid", pid);
            model.addAttribute("fid", fid);
            model.addAttribute("deptcode", deptcode);
            model.addAttribute("fpath", utilService.getConfig("path"));

            //名族
            model.addAttribute("minzu", utilService.optionList("B", "0"));
            //政治面貌
            model.addAttribute("zzmm", utilService.optionList("E", "0"));
            //最高学历
            model.addAttribute("education", utilService.optionList("F", "0"));
            //招聘地区
            model.addAttribute("regions", utilService.optionList("M", "0"));
            //招聘岗位
            List<ProjectInfoJobs> projectJobs=utilService.getProjectJobs(pid);
            model.addAttribute("jobs",projectJobs);

            ProjectInfoFlow projectInfoFlow= projectService.getFolwById(fid);
            if(projectInfoFlow!=null){
                model.addAttribute("nowflow",projectInfoFlow.getNickname());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "Do/GXCampus/Resume/index";
    }

    /*@SuppressWarnings("unchecked")
    @RequestMapping("/getusers")
    public void getusers(HttpServletRequest request, HttpServletResponse response, DUserResume resume) {
        try {
            int perpage = Integer.parseInt(request.getParameter("perpage"));
            int page = Integer.parseInt(request.getParameter("page"));
            String flowid = request.getParameter("flowid").trim();

            Map<String, Object> _map = new HashMap<String, Object>();
            _map.put("agefrom", request.getParameter("agefrom").trim());
            _map.put("ageto", request.getParameter("ageto").trim());
            _map.put("heightfrom", request.getParameter("heightfrom").trim());
            _map.put("heightto", request.getParameter("heightto").trim());
            _map.put("rcount",request.getParameter("rcount").trim());

            Map<String, Object> map = doGXService.getResumes(page, perpage, resume, _map);
            StringBuilder result = new StringBuilder();
            double pageCount = (Double) map.get("pageCount");
            double allcount = (Double) map.get("count");

            if (pageCount != 0) {
                Object object = map.get("list");
                for (DUserResume dur : (List<DUserResume>) object) {
                    result.append("<tr><td><input type='checkbox' id='cb_" + dur.getId() + "' /></td>");
                    //投简历总次数
                    if (dur.getRcount()!=null&&dur.getRcount() > 1) {
                        result.append("<td class='mopen' title='" + dur.getRcount() + "'><span>" + dur.getCode() + "</span></td>");
                    } else {
                        result.append("<td title='" + dur.getRcount() + "'>" + dur.getCode() + "</td>");
                    }
                    result.append("<td class='link'><a target='_blank' href='" + request.getContextPath() + "/UserResume/ViewDResume?id=" + dur.getId() + "'>" + dur.getName() + "</a></td>");
                    result.append("<td>" + dur.getCardno() + "</td>");
                    result.append("<td>" + dur.getSexname() + "</td>");
                    result.append("<td>" + DateTools.BirthdayToAge(dur.getBirthday()) + "</td>");
                    result.append("<td>" + dur.getZzmmname() + "</td>");
                    *//*result.append("<td>" + dur.getCardaddress()+"</td>");*//*
                    result.append("<td>" + dur.getUniversity() + "</td>");
                    result.append("<td>" + dur.getMajorname() + "</td>");
                    result.append("<td>" + dur.getEducationname() + "</td>");
                    result.append("<td>" + (dur.getGraduationtime() == null ? "" : dur.getGraduationtime()) + "</td>");
                    result.append("<td>" + dur.getTel() + "</td>");
                    result.append("<td>" + dur.getState() + "</td>");
                    result.append("<td>" + dur.getSxbz() + "</td>");
                    if (dur.getOp1() == null || dur.getOp1().equals("未公布")) {
                        result.append("<td class='true'><span>未公布</span></td>");
                    } else {
                        result.append("<td class='false'><span>已公布</span></td>");
                    }

                    if (dur.getFqstate().equals("已放弃")
                            && dur.getFqfid().equals(flowid)) {
                        result.append("<td class='yfq'><span>已放弃</span></td></tr>");
                    } else {
                        if (dur.getState().equals("未处理")) {
                            result.append("<td class='true'><span>未完成</span></td></tr>");
                        } else if (dur.getState().equals("未通过")) {
                            result.append("<td class='false'><span>已完成</span></td></tr>");
                        } else {
                            boolean bl = dur.getFid().equals(flowid);
                            result.append("<td class='" + bl + "'><span>" + (bl == true ? "未完成" : "已完成") + "</span></td></tr>");
                        }
                    }
                }
            } else {
                result.append("<tr><td colspan='16'>无符合条件的信息</td></tr>");
            }
            result.append("<input type='hidden' id='pageCount' value='" + pageCount + "' />");
            result.append("<input type='hidden' id='allCount' value='" + allcount + "' />");
            utilService.printTextResult(result.toString(), response);
        } catch (Exception e) {
            e.printStackTrace();
            utilService.printTextResult("<tr><td colspan='15'>系统出错了</td></tr><input type='hidden' id='pageCount' value='0' /><input type='hidden' id='allCount' value='0' />", response);
        }
    }*/
    //[end]

    //region 20190225 变更查询为复杂查询
    @RequestMapping("/getusers")
    public void getusers(HttpServletRequest request, HttpServletResponse response, DUserResume resume) {
        try {
            int perpage = Integer.parseInt(request.getParameter("perpage"));
            int page = Integer.parseInt(request.getParameter("page"));
            String flowid = request.getParameter("flowid").trim();

            Map<String, Object> _map = new HashMap<String, Object>();
            _map.put("agefrom", request.getParameter("agefrom").trim());
            _map.put("ageto", request.getParameter("ageto").trim());
            _map.put("heightfrom", request.getParameter("heightfrom").trim());
            _map.put("heightto", request.getParameter("heightto").trim());
            _map.put("rcount",request.getParameter("rcount").trim());

            Map<String, Object> map = doGXService.getResumesMap(page, perpage, resume, _map);
            StringBuilder result = new StringBuilder();
            double pageCount = (Double) map.get("pageCount");
            double allcount = (Double) map.get("count");

            if (pageCount != 0) {
                List<HashMap> object = (List<HashMap>)map.get("list");
                for (HashMap<String,Object> _user :  object) {
                    result.append("<tr><td><input type='checkbox' id='cb_" + _user.get("ID") + "' /></td>");
                    //投简历总次数
                    Integer cardcount= Integer.parseInt(_user.get("CARDCOUNT").toString());
                    if (cardcount>1){
                        result.append("<td class='link'><a target='_blank' href='" + request.getContextPath() + "/UserResume/ViewDResume?id=" + _user.get("ID") + "'>" + _user.get("NAME") + "</a>&nbsp;<span class='layui-badge'>"+_user.get("CARDCOUNT")+"</span></td>");
                    }else{
                        result.append("<td class='link'><a target='_blank' href='" + request.getContextPath() + "/UserResume/ViewDResume?id=" + _user.get("ID") + "'>" + _user.get("NAME") + "</a></td>");
                    }

                    result.append("<td>" + _user.get("CARDNO") + "</td>");
                    result.append("<td>" + _user.get("SEXNAME") + "</td>");
                    result.append("<td>" + DateTools.BirthdayToAge((Date) _user.get("BIRTHDAY")) + "</td>");
                    result.append("<td>" + _user.get("ZZMMNAME") + "</td>");
                    result.append("<td>" + _user.get("UNIVERSITY") + "</td>");
                    result.append("<td>" + _user.get("MAJORNAME") + "</td>");
                    result.append("<td>" + _user.get("EDUCATIONNAME") + "</td>");
                    result.append("<td>" + (_user.get("GRADUATIONTIME") == null ? "" : _user.get("GRADUATIONTIME")) + "</td>");
                    result.append("<td>" + _user.get("JNAME") + "</td>");
                    result.append("<td>" + _user.get("STATE")  + "</td>");
                    result.append("<td>" + (_user.get("SXBZ") == null ? "" : _user.get("SXBZ")) + "</td>");
                    if (_user.get("OP1") == null || _user.get("OP1").equals("未公布")) {
                        result.append("<td></td>");
                        result.append("<td><input type='hidden' value='"+_user.get("MID")+"'>"+ (_user.get("MCONTENT") == null ? "" : _user.get("MCONTENT")) + "</td>");
                        result.append("<td class='true'><span>未公布</span></td>");
                    } else {
                        result.append("<td>"+ (_user.get("LOGINTIME")==null?"":_user.get("LOGINTIME").toString())+"</td>");
                        result.append("<td><input type='hidden' value='"+_user.get("MID")+"'>"+ (_user.get("MCONTENT") == null ? "" : _user.get("MCONTENT")) + "</td>");
                        result.append("<td class='false'><span>已公布</span></td>");
                    }
                    result.append("<td>");
                    if (_user.get("FQSTATE").equals("已放弃")
                            && _user.get("FQFID").equals(flowid)) {

                      // result.append("<td class='yfq'><span>已放弃</span></td></tr>");
                        result.append("<span class='layui-badge layui-bg-gray' title='已放弃'>弃</span>");
                    } else {
                        if (_user.get("STATE").equals("未处理")) {
                           // result.append("<td class='true'><span>未完成</span></td></tr>");
                            result.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
                        } else if (_user.get("STATE").equals("未通过")||_user.get("STATE").equals("不通过")||_user.get("STATE").equals("不合格")||_user.get("STATE").equals("未合格")) {
                            result.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
                            //result.append("<td class='false'><span>已完成</span></td></tr>");
                        } else {
                            boolean bl = _user.get("FID").equals(flowid);
                            if (bl){
                                result.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
                            }else{
                                result.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
                            }
                           // result.append("<td class='" + bl + "'><span>" + (bl == true ? "未完成" : "已完成") + "</span></td></tr>");

                        }
                    }
                    if (StringTools.trimNotEmpty(_user.get("NRID"))){
                        result.append("<span class='layui-badge layui-bg-blue' title='转岗(原岗位:"+_user.get("NJNAME")+")'>岗</span>");
                    }
                    result.append("</td>");
                    result.append("</tr>");
                }
            } else {
                result.append("<tr><td colspan='18'>无符合条件的信息</td></tr>");
            }
            result.append("<input type='hidden' id='pageCount' value='" + pageCount + "' />");
            result.append("<input type='hidden' id='allCount' value='" + allcount + "' />");
            utilService.printTextResult(result.toString(), response);
        } catch (Exception e) {
            e.printStackTrace();
            utilService.printTextResult("<tr><td colspan='16'>系统出错了</td></tr><input type='hidden' id='pageCount' value='0' /><input type='hidden' id='allCount' value='0' />", response);
        }
    }

    //endregion



    //[start] 查看某一个人投过哪些招聘方案

    @RequestMapping("/hisresume")
    public String hisResume(HttpServletRequest request, Model model) {
        try {
            String code = request.getParameter("code").trim();
            List<Object[]> lists = doGXService.getResumes(code);
            StringBuffer str = new StringBuffer();
            int num = 1;
            for (Object[] dr : lists) {
                str.append("<tr><td>" + num + "</td>");
                str.append("<td>" + dr[1] + "</td>");
                str.append("<td>" + dr[2] + "</td>");
                str.append("<td>" + dr[3] + "</td></tr>");
                num++;
            }
            model.addAttribute("res", str);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "Do/GXCampus/Resume/hisresume";
    }

    //[end]

    //[start] 通过简历筛选
    @RequestMapping(value = "/ResumeOkAction", method = RequestMethod.POST)
    public void ResumeOkAction(HttpServletRequest request, HttpServletResponse response) {
        try {
            String fid = request.getParameter("fid").trim();//招聘流程ID
            String deptcode = request.getParameter("deptcode").trim();//责任部门编码

            BaseUser cuser = utilService.getSessionUser(request);
            //if (cuser.getUdept().equals(deptcode)) {
                //流程是否结束
                if (utilService.FlowIsDoing(fid)) {
                    String[] ids = request.getParameterValues("id");
                    if (ids != null) {
                        List<DUserResume> editList = new ArrayList<DUserResume>();
                        List<DUserResume> resumes = doGXService.getResumes(ids);
                        for (DUserResume dUserResume : resumes) {
                            if (dUserResume.getFid().equals(fid)
                                    && dUserResume.getFqstate().equals("未放弃")) {
                                dUserResume.setState("已通过");
                                dUserResume.setEditDate(new Date());
                                dUserResume.setEditUserid(cuser.getId());
                                dUserResume.setEditUserName(cuser.getUname());
                                editList.add(dUserResume);
                            }
                        }
                        utilService.editList(editList);
                        utilService.printJsonResult(true, "操作成功！", "no", response);
                    } else {
                        utilService.printJsonResult(false, "请选择应聘者！", "no", response);
                    }
                } else {
                    utilService.printJsonResult(false, "当前流程不支持此操作！", "no", response);
                }
           /* } else {
                utilService.printJsonResult(false, "您无权执行此操作！", "no", response);
            }*/
        } catch (Exception e) {
            e.printStackTrace();
            utilService.printJsonResult(false, "操作失败！", "no", response);
        }
    }

    //[end]

    //[start] 批量通过简历筛选
    /**
     * 批量通过简历筛选
     * @param request
     * @param response
     */
    @RequestMapping(value = "/ResumeAllOkAction", method = RequestMethod.POST)
    public void ResumeAllOkAction(HttpServletRequest request, HttpServletResponse response) {
        try {
            String fid = request.getParameter("fid").trim();//招聘流程ID
            String deptcode = request.getParameter("deptcode").trim();//责任部门编码

            BaseUser cuser = utilService.getSessionUser(request);
            //if (cuser.getUdept().equals(deptcode)) {
                //流程是否结束
                if (utilService.FlowIsDoing(fid)) {
                    //String[] ids = request.getParameterValues("ids");
                    String sid=request.getParameter("ids");
                    String[] ids=sid.split(",");
                    if(ids!=null&&ids.length>0){
                        List<DUserResume> editList = new ArrayList<DUserResume>();
                        List<DUserResume> resumes = doGXService.getResumes(ids);
                        for (DUserResume dUserResume : resumes) {
                            if (dUserResume.getFid().equals(fid)
                                    && dUserResume.getFqstate().equals("未放弃")
                                    && dUserResume.getNrid() == null) {
                                dUserResume.setState("已通过");
                                dUserResume.setEditDate(new Date());
                                dUserResume.setEditUserid(cuser.getId());
                                dUserResume.setEditUserName(cuser.getUname());
                                editList.add(dUserResume);
                            }
                        }
                        if (editList.size() > 0) {
                            utilService.editList(editList);
                            utilService.printJsonResult(true, "操作成功！", "no", response);
                        } else {
                            utilService.printJsonResult(false, "当前选中的简历不能执行此操作！", "no", response);
                        }

                    }else{
                        utilService.printJsonResult(false, "请至少选择应聘者！", "no", response);
                    }
                } else {
                    utilService.printJsonResult(false, "当前流程不支持此操作！", "no", response);
                }
           /* } else {
                utilService.printJsonResult(false, "您无权执行此操作！", "no", response);
            }*/
        } catch (Exception e) {
            e.printStackTrace();
            utilService.printJsonResult(false, "操作失败！", "no", response);
        }
    }

    //[end]


    //[start] 未通过简历筛选

    @RequestMapping("/bz")
    public String BZ(HttpServletRequest request, Model model) {
        try {
            model.addAttribute("path", request.getContextPath());
            String id = request.getParameter("id").trim();
            model.addAttribute("id", id);
            model.addAttribute("pid", request.getParameter("pid").trim());
            model.addAttribute("fid", request.getParameter("fid").trim());
            model.addAttribute("deptcode", request.getParameter("deptcode").trim());
            DUserResume resume = doGXService.getDUserResume(id);
            model.addAttribute("bz", resume.getSxbz());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "Do/GXCampus/Resume/bz";
    }

    @RequestMapping(value = "/ResumeNoAction", method = RequestMethod.POST)
    public void ResumeNoAction(HttpServletRequest request, HttpServletResponse response) {
        try {
            String fid = request.getParameter("fid").trim();//招聘流程ID
            String deptcode = request.getParameter("deptcode").trim();//责任部门编码

            BaseUser cuser = utilService.getSessionUser(request);
            //if (cuser.getUdept().equals(deptcode)) {
                //流程是否结束
                if (utilService.FlowIsDoing(fid)) {
                    DUserResume dUserResume = doGXService.getDUserResume(request.getParameter("id").trim());
                    if (dUserResume.getFid().equals(fid)
                            && dUserResume.getFqstate().equals("未放弃")) {
                        dUserResume.setState("未通过");
                        dUserResume.setSxbz(request.getParameter("sxbz"));
                        dUserResume.setEditDate(new Date());
                        dUserResume.setEditUserid(cuser.getId());
                        dUserResume.setEditUserName(cuser.getUname());

                        utilService.editObject(dUserResume);
                        utilService.printJsonResult(true, "操作成功！", "no", response);
                    } else {
                        utilService.printJsonResult(false, "该应聘者简历筛选已完成，不能执行此操作", "no", response);
                    }
                } else {
                    utilService.printJsonResult(false, "当前流程不支持此操作！", "no", response);
                }
            /*} else {
                utilService.printJsonResult(false, "您无权执行此操作！", "no", response);
            }*/
        } catch (Exception e) {
            e.printStackTrace();
            utilService.printJsonResult(false, "操作失败！", "no", response);
        }
    }

    //[end]


    //[start] 未通过简历筛选
    @RequestMapping(value = "/ResumeAllNoAction", method = RequestMethod.POST)
    public void ResumeAllNoAction(HttpServletRequest request, HttpServletResponse response) {
        try {
            String fid = request.getParameter("fid").trim();//招聘流程ID
            String deptcode = request.getParameter("deptcode");//责任部门编码
            BaseUser cuser = utilService.getSessionUser(request);

            //if (cuser.getUdept().equals(deptcode)) {
                //流程是否结束
                if (utilService.FlowIsDoing(fid)) {
                    String sid=request.getParameter("ids");
                    String[] ids=sid.split(",");
                    if(ids!=null&&ids.length>0){
                        List<DUserResume> editList = new ArrayList<DUserResume>();
                        List<DUserResume> resumes = doGXService.getResumes(ids);
                        String sxbz=request.getParameter("sxbz");
                        for (DUserResume dUserResume : resumes) {
                            if (dUserResume.getFid().equals(fid)
                                    && dUserResume.getFqstate().equals("未放弃")) {
                                dUserResume.setState("未通过");
                                dUserResume.setSxbz(sxbz);
                                dUserResume.setEditDate(new Date());
                                dUserResume.setEditUserid(cuser.getId());
                                dUserResume.setEditUserName(cuser.getUname());
                                editList.add(dUserResume);
                            }
                        }
                        if (editList.size() > 0) {
                            utilService.editList(editList);
                            utilService.printJsonResult(true, "操作成功！", "no", response);
                        } else {
                            utilService.printJsonResult(false, "当前选中的简历不能执行此操作！", "no", response);
                        }

                    }else {
                        utilService.printJsonResult(false, "请至少选择应聘者！", "no", response);
                    }
                } else {
                    utilService.printJsonResult(false, "当前流程不支持此操作！", "no", response);
                }
           /* } else {
                utilService.printJsonResult(false, "您无权执行此操作！", "no", response);
            }*/
        } catch (Exception e) {
            e.printStackTrace();
            utilService.printJsonResult(false, "操作失败！", "no", response);
        }
    }
    //[end]

/*    @RequestMapping(value = "/SendInfos", method = RequestMethod.POST)
    public void SendInfos(HttpServletRequest request, HttpServletResponse response) {
        try {
            String pid = request.getParameter("pid").trim();//招聘方案ID
            String fid = request.getParameter("fid").trim();//招聘流程ID
            String deptcode = request.getParameter("deptcode").trim();//责任部门编码
            String infoContent = request.getParameter("infoContent").trim();//信息内容

            String[] ids = request.getParameterValues("id");//人员信息ID
            if (ids != null) {
                ProjectInfo projectInfo = doGXService.getProject(pid);
                List<SendInfos> editLists = new ArrayList<SendInfos>();
                for(int i=0;i<ids.length;i++){
                    SendInfos sendInfos = new SendInfos();
                    ProjectInfoFlow projectInfoFlow= doGXService.getCurrentFlow(pid,deptcode,ids[i]);
                    sendInfos.setId(ids[i]);
                    sendInfos.setPid(pid);
                    sendInfos.setFid(projectInfoFlow.getFid());
                    sendInfos.setNickname(projectInfoFlow.getNickname());
                    sendInfos.setInfos(infoContent);
                    sendInfos.setIsread("未读");
                    sendInfos.setSendtime(new Date());
                    sendInfos.setSenduid(projectInfo.getAdduid());
                    sendInfos.setSenduname(projectInfo.getAdduname());

                    editLists.add(sendInfos);
                }
                if(editLists.size()>0){
                    utilService.editList(editLists);
                    utilService.printJsonResult(true, "操作成功！", "no", response);
                }else
                    utilService.printJsonResult(false, "当前选中的信息不能执行此操作！", "no", response);
            }else {
                utilService.printJsonResult(false, "请选择应聘者！", "no", response);
            }
        }catch (Exception e) {
            e.printStackTrace();
            utilService.printJsonResult(false, "操作失败！", "no", response);
        }
    }*/

    //[start] 流程扭转到下一步

    @SuppressWarnings({"rawtypes", "unchecked"})
    @RequestMapping(value = "/NextAction", method = RequestMethod.POST)
    public void NextAction(HttpServletRequest request, HttpServletResponse response) {
        try {
            String[] ids = request.getParameterValues("id");//人员信息ID
            if (ids != null) {
                String pid = request.getParameter("pid").trim();//招聘方案ID
                String fid = request.getParameter("fid").trim();//招聘流程ID
                String deptcode = request.getParameter("deptcode").trim();//责任部门编码
                BaseUser usr = utilService.getSessionUser(request);
                if (usr.getUdept().equals(deptcode)) {
                    //流程是否结束
                    if (utilService.FlowIsDoing(fid)) {
                        List editlist = new ArrayList();
                        List<DUserResume> resumes = doGXService.getResumes(ids);
                        ProjectInfoFlow nFlow = doGXService.getNextFlow(pid, deptcode, fid);
                        for (DUserResume user : resumes) {
                            if (user.getFid().equals(fid)&& user.getFqstate().equals("未放弃")) {
                                if(user.getState().equals("已通过")||user.getState().equalsIgnoreCase("通过")||user.getState().equalsIgnoreCase("合格")||user.getState().equalsIgnoreCase("已合格")) {
                                    user.setFid(nFlow.getId());
                                    user.setPath(user.getPath() + nFlow.getId() + "/");
                                    editlist.add(user);
                                }
                            }
                        }

                        if (editlist.size() > 0) {
                            nFlow.setState(EnumTools.PlanFlowState.进行中.ordinal());
                            editlist.add(nFlow);

                            utilService.editList(editlist);
                            utilService.printJsonResult(true, "操作成功！", "no", response);
                        } else {
                            utilService.printJsonResult(false, "当前选中的信息不能执行此操作！", "no", response);
                        }
                    } else {
                        utilService.printJsonResult(false, "当前流程不支持此操作！", "no", response);
                    }
                } else {
                    utilService.printJsonResult(false, "您无权执行此操作！", "no", response);
                }
            } else {
                utilService.printJsonResult(false, "请选择人员信息！", "no", response);
            }
        } catch (Exception e) {
            e.printStackTrace();
            utilService.printJsonResult(false, "操作失败！", "no", response);
        }
    }

    //[end]
}
